package org.aphelie.torg.ruler.internal.core.character;

import java.io.PrintWriter;

import org.aphelie.torg.ruler.core.character.ICharacterModelBase;
import org.aphelie.torg.ruler.core.character.ICharacterObject;
import org.aphelie.torg.ruler.core.character.ICharacterSketch;
import org.aphelie.torg.ruler.core.character.ISharedCharacterModel;
import org.aphelie.torg.ruler.internal.core.util.TGRXMLHelper;
import org.eclipse.core.runtime.CoreException;


public class CharacterSketch extends CharacterObject implements ICharacterSketch {
    
    private static final long serialVersionUID = 1L;
    
    private String fAge;

    public CharacterSketch() {
        super();
    }

    public String getAge() {
        return fAge;
    }

    public void setAge(String value) throws CoreException {
        ensureModelEditable();
        String oldValue = fAge;
        fAge = value;
        firePropertyChanged(K_AGE, oldValue, fAge);        
    }
    
    @Override
    public void write(String indent, PrintWriter writer) {

        ICharacterModelBase modelBase = getCharacterModel();

            writer.print(indent);
            writer.print("<library name=\"" + TGRXMLHelper.getWritableString(getName()) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
            /*
            if (fType != null)
                writer.print(" type=\"" + fType + "\""); //$NON-NLS-1$ //$NON-NLS-2$
            if (!isExported()) {
                writer.println("/>"); //$NON-NLS-1$
            } else {
                writer.println(">"); //$NON-NLS-1$
                String indent2 = indent + "   "; //$NON-NLS-1$
                if (isExported()) {
                    if (isFullyExported()) {
                        writer.println(indent2 + "<export name=\"*\"/>"); //$NON-NLS-1$
                    } else {
                        for (int i = 0; i < fContentFilters.length; i++) {
                            writer.println(indent2 + "<export name=\"" //$NON-NLS-1$
                                    + fContentFilters[i] + "\"/>"); //$NON-NLS-1$
                        }
                    }
                }
                writer.println(indent + "</library>"); //$NON-NLS-1$
            }*/
            writer.println("/>"); //$NON-NLS-1$
        
    }
    
    public void reconnect(ISharedCharacterModel model, ICharacterObject parent) {
        super.reconnect(model, parent);
        // No transient fields
    }

}
